<?php
class ORMPackage extends ORMBase {
  public function __construct() {
    parent::__construct('Package');
  }

  public function __toEpObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMPackagePurchase.class.php';
    $epObject->trackId = isset($object->trackId) ? $object->trackId : '';
    $epObject->name = isset($object->name) ? $object->name : '';
    $epObject->price = isset($object->price) ? $object->price : 0;
    $epObject->hours = isset($object->hours) ? $object->hours : 0;
    $epObject->persons = isset($object->persons) ? $object->persons : 0;
    $epObject->makeup = isset($object->makeup) ? $object->makeup : '';
    $epObject->type = isset($object->type) ? $object->type : '';
    $epObject->orderType = isset($object->orderType) ? $object->orderType : '';
    if (isset($epObject->purchases)) {
      $epObject->purchases->removeAll();
      foreach ($object->purchases as &$item) {
        $epObject->purchases[] = $this->__getEpObject_4_lvl_1_object($myManager, $item, new ORMPackagePurchase(), 'PackagePurchase');
      }
    }
    return $epObject;
  }

  public function __toObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMPackagePurchase.class.php';
    $object->id = $epObject->oid;
    $object->trackId = $epObject->trackId;
    $object->name = $epObject->name;
    $object->price = $epObject->price;
    $object->hours = $epObject->hours;
    $object->persons = $epObject->persons;
    $object->makeup = $epObject->makeup;
    $object->type = $epObject->type;
    $object->orderType = $epObject->orderType;
    $object->purchases = array();
    if (isset($epObject->purchases)) {
      foreach ($epObject->purchases as &$item) {
        $object->purchases[] = $this->__getObject_4_lvl_1_ep_object($myManager, $item, new ORMPackagePurchase());
      }
    }
    return $object;
  }
}
?>
